package com.xaicode.auth.domain.params;

import lombok.Data;

/**
 * 分页参数封装
 */
@Data
public class PageVo {

    public final int DEFAULT_PAGE_NUM = 1;
    public final int DEFAULT_PAGE_SIZE = 10;


    /**
     * 页码
     */
    private Integer pageNum;

    /**
     * 每页条数
     */
    private Integer pageSize;


    /**
     * 排序列名
     */
    //private String[] sortCols;

    /**
     * 排序方式
     * <p>
     * ASC/DESC
     */
    //private String direction;


    // ----
    public Integer getPageNum() {
        return (pageNum == null || pageNum < 0) ? DEFAULT_PAGE_NUM : pageNum;
    }

    public Integer getPageSize() {
        return (pageSize == null || pageSize < 1) ? DEFAULT_PAGE_SIZE : pageSize;
    }

}
